package com.yh.workbill.ui.addworkbill;

import com.yh.workbill.App;
import com.yh.workbill.db.Company;
import com.yh.workbill.db.CompanyDao;
import com.yh.workbill.db.UnitCompany;
import com.yh.workbill.db.UnitCompanyDao;

import java.util.List;

import androidx.lifecycle.LiveData;

public class AddWorkBillRepository {
    public CompanyDao companyDao;
    public UnitCompanyDao unitCompanyDao;

    public LiveData<List<Company>> listCompany;
    public LiveData<List<UnitCompany>> listUnitCompany;

    public AddWorkBillRepository() {
        companyDao = App.appDataBase.getCompanyDao();
        unitCompanyDao = App.appDataBase.getUnitCompanyDao();
        listCompany = companyDao.getComanys();
        listUnitCompany = unitCompanyDao.getUnitComanys();
    }


    public void addCompany(String company_name) {
        companyDao.add(new Company(company_name, "", ""));
    }

    public void addUnitCompany(String unit_name) {
        unitCompanyDao.add(new UnitCompany(unit_name));
    }

}
